<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="upon">
    <title>注册</title>
    <link rel="icon" href="./img/favicon.ico" type="image/ico">
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js "></script>
    <link rel="stylesheet" href="./css/register.css">
</head>

<body>
    <header>
        <div class="dog">
            <span class="icon1"></span><span class="fontsize24">欢迎注册</span>
        </div>
        <div class="dog">已有账号？请登录</div>
    </header>
    <main>
        <form action="/api/register" method="post">
            <div class="form-group">
                <div class="input-group">
                    <span class="input-group-addon"> <label class="control-label" for="username">用户名</label></span>
                    <input type="text" class="form-control" name="username" id="username" placeholder="您的账户名和登录名">
                </div>
            </div>
            <div class="form-group ">
                <div class="input-group">
                    <span class="input-group-addon"> <label class="control-label" for="psw">设置密码</label></span>
                    <input class="form-control" type="password" name="password" id="password" placeholder="建议至少使用两种字符组合">
                </div>
            </div>
            <div class="form-group ">
                <div class="input-group">
                    <span class="input-group-addon"> <label class="control-label" for="psw1">设置密码</label></span>
                    <input class="form-control" type="password" name="psw1" id="psw1" placeholder="请再次输入密码">
                </div>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <span class="input-group-addon"> <label class="control-label" for="tphoto"><select name="telephone"  style="border:none">
                        <option value="中国0086">中国0086</option>
                        <option value="中国台湾0886">中国台湾0886</option>
                        <option value="中国香港0852">中国香港0852</option>
                        <option value="中国澳门0853">中国澳门0853</option>
                    </select></label></span>
                    <input type="text" class="form-control" name="tphoto" id="tphoto" placeholder="建议使用常用手机">
                </div>
            </div>
            <div class="form-group ">
                <div class="input-group">
                    <span class="input-group-addon"> <label class="control-label" for="course">验证码</label></span>
                    <input type="text" class="form-control" id="course" name="course" placeholder="请输入验证码">
                </div>
              
            </div>
            <div class="form-group ">
                <div class="input-group">
                    <span class="input-group-addon"> <label class="control-label" for="course1">手机验证码</label></span>
                    <input type="text" class="form-control" id="course1" name="course1" placeholder="请输入手机验证码" >
                    <span class="input-group-addon">获取验证码</span>
                </div>
            </div>

              <div class="form-group ">
            <button type="submit" style="width:100%">立即注册</button>
                 </div>
        </form>
<div class="method">
<section class="icon2">
    
</section><span>企业用户注册</span>
<section class="icon3">
    
</section><span>INTERNATIONALCUSTOMERS</span>
</div>
    </main>
    <footer>
        
<p>关于我们| 联系我们| 人才招聘| 商家入驻| 广告服务| 手机京东| 友情链接| 销售联盟| 京东社区| 京东公益| English Site</p>
<p>Copyright©2004-2016  京东JD.com 版权所有</p>

</footer>
    <script src="bootstrap/js/jquery.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>
    <script>
 $('form').submit(function (e) {
            e.preventDefault();
            // 验证两次密码是否一致
            var password = $(':password').map(function (item) {
                return $(this).val();
            });
           if (password[0] == password[1]) {
                //  发送请求进行注册
                $.post(this.action, $(this).serialize(), (data) => {
                    alert(data.message);
                    if (data.code == 'success') {
                        // 注册成功
                        location.href = './load.html'
                    }
                    
                })
            } else {
                alert('两次密码不一致，请重新输入');
            }


        })
    </script>
</body>

</html>